#include<iostream>
#include<string>
#include<cmath>
using namespace std;
typedef long long ll;

ll gcd(ll m,ll n){
	return n?(gcd(n,m%n)):m;
}
void deal( ll dividend,ll divisor){
	if(divisor*dividend==0){
		divisor==0?printf("Inf"):printf("0");
	}else{
		bool sign =(divisor^dividend)<0;
		divisor=abs(divisor);
		dividend=abs(dividend);
		if(sign){
			printf("(-");
		}
		int k=0;
		if(dividend/divisor){
            		k=dividend/divisor;
            		dividend-=k*divisor;
		}
		if(k)printf("%d",k);
		if(dividend%divisor){
			int divisor_temp=divisor;
			int dividend_temp=dividend;
			divisor/=gcd(divisor_temp,dividend_temp);
			dividend/=gcd(divisor_temp,dividend_temp);
            		if(k)printf(" ");
			printf("%lld/%lld",dividend,divisor);
		}
		if(sign) printf(")");
	}
}

int main(){
	freopen("input.txt","r",stdin);
	ll a,b,c,d;
	scanf("%lld/%lld %lld/%lld",&a,&b,&c,&d);
	deal(a,b);printf(" + ");deal(c,d);printf(" = ");deal(a*d+c*b,b*d);printf("\n");
	deal(a,b);printf(" - ");deal(c,d);printf(" = ");deal(a*d-c*b,b*d);printf("\n");
	deal(a,b);printf(" * ");deal(c,d);printf(" = ");deal(a*c,b*d);printf("\n");
	deal(a,b);printf(" / ");deal(c,d);printf(" = ");deal(a*d,b*c);
}